package com.ddpt.platform.common.util.excel;

import java.util.Set;

/**
 * 读取excel监听器
 */
public class ReadExcelBeanListener<T> extends AbstractReadExcelListener<T,T> {

    private ReadExcelBeanListener(){}

    public static <T> ReadExcelBeanListener<T> builder(Integer maxReadCount, Set<Integer> skipRow, ExcelReaderCallBack<T> callBack) {
        ReadExcelBeanListener<T> listener = new ReadExcelBeanListener<>();
        if (maxReadCount != null && maxReadCount > 0) {
            listener.maxReadCount = maxReadCount;
        }
        if (callBack != null) {
            listener.callBack = callBack;
        }
        if (skipRow != null){
            listener.setSkipRow(skipRow);
        }
        return listener;
    }

    public static <T>ReadExcelBeanListener<T> builder(Integer maxReadCount,ExcelReaderCallBack<T> callBack){
        ReadExcelBeanListener<T> listener = new ReadExcelBeanListener<>();
        if(maxReadCount!=null && maxReadCount>0){
            listener.maxReadCount = maxReadCount;
        }
        if(callBack != null){
            listener.callBack = callBack;
        }
        return listener;
    }

}
